﻿<UserControl x:Class="PokemonBattleOnline.PBO.Editor.PokemonBank"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:ui="clr-namespace:PokemonBattleOnline.PBO.Elements"
             xmlns:e="clr-namespace:PokemonBattleOnline.PBO.Editor"
             Background="Transparent" AllowDrop="True">
    <Grid>
        <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
        	<ScrollViewer.Template>
        		<ControlTemplate TargetType="{x:Type ScrollViewer}">
        			<Grid x:Name="Grid" Background="{TemplateBinding Background}">
        				<Grid.RowDefinitions>
        					<RowDefinition Height="Auto"/>
        					<RowDefinition Height="*"/>
        				</Grid.RowDefinitions>
        				<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}" Grid.Row="1"/>
        				<ScrollBar x:Name="PART_VerticalScrollBar" Visibility="Collapsed"/>
        				<ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="0" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
        			</Grid>
        		</ControlTemplate>
        	</ScrollViewer.Template>
            <Grid>
                <ItemsControl ItemsSource="{Binding Teams}" ItemsPanel="{x:Static ui:Controls.VerticalWrapPanel}" HorizontalAlignment="Left">
                    <ItemsControl.ItemContainerStyle>
                        <Style TargetType="ContentPresenter">
                            <Setter Property="Height" Value="32"/>
                            <Setter Property="ContentTemplate">
                                <Setter.Value>
                                    <DataTemplate>
                                        <e:TeamView x:Name="main" DataContext="{Binding}"/>
                                        <DataTemplate.Triggers>
                                            <DataTrigger Binding="{Binding}" Value="{x:Null}">
                                                <Setter TargetName="main" Property="Visibility" Value="Collapsed"/>
                                            </DataTrigger>
                                        </DataTemplate.Triggers>
                                    </DataTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ItemsControl.ItemContainerStyle>
                </ItemsControl>
                <Grid Height="32" Width="292" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <Grid.Resources>
                        <Style TargetType="Button">
                            <Setter Property="Cursor" Value="Hand"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="Button">
                                        <Grid x:Name="grid" Background="Transparent">
                                            <TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" IsHitTestVisible="False" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                        </Grid>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="grid" Property="Background" Value="#40ffffff"/>
                                            </Trigger>
                                            <Trigger Property="IsPressed" Value="True">
                                                <Setter TargetName="grid" Property="Background" Value="#80ffffff"/>
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Grid.Resources>
                    <Rectangle IsHitTestVisible="False" Margin="3,2">
                        <Rectangle.Fill>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                <GradientStop Color="#80ffffff" Offset="0.5"/>
                                <GradientStop Color="#00ffffff" Offset="1"/>
                            </LinearGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                    <Button Content="新建队伍" Click="NewTeam_Click" Foreground="#006600" Margin="3,2,146,2"/>
                    <Button Content="从剪贴板导入" Click="PasteTeam_Click" Foreground="#333333" Margin="146,2,3,2"/>
                </Grid>
            </Grid>
        </ScrollViewer>
        <Canvas IsHitTestVisible="False">
            <Image x:Name="DragIcon"/>
        </Canvas>
    </Grid>
</UserControl>
